/**
 * 
 */
package com.james.android.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

/**
 * 应用常用工具
 * @author Winter Lau
 */
public class AppUtils {

	private PackageInfo pkg;
	
	public AppUtils(Context ctx){
		try {
			this.pkg = ctx.getPackageManager().getPackageInfo(ctx.getClass().getPackage().getName(), PackageManager.GET_ACTIVITIES);
		} catch (NameNotFoundException e) {
			throw new RuntimeException(e);
		}
	}

	public String getVersionName(){
		return pkg.versionName ;
	}
	
	public int getVersionCode(){
		return pkg.versionCode;
	}
	
}
